/*
 *  queue.h
 *  
 *
 *  Created by Mario Serrano on 4/15/13.
 *  Copyright 2013 __MyCompanyName__. All rights reserved.
 *
 */
#include <iostream>

using namespace std;

struct node {
	string Value;
	node *next;
};

class Queue {
private:
	node *front;
	node *rear;
public:
	Queue();
	~Queue();
	void enqueue(int);
	string dequeue();
	node* getHead(); 
	void printQueue(); 

};

void Queue::printQueue(){
	node *p = new node;
	p = front;
	if (front == NULL) {
		cout << "empty";
	}
	else {
		while (p!=NULL) {
			cout << p->Value <<endl;
			p = p->next;
		}
	}


}

Queue::Queue(){
	front = NULL;
	rear = NULL;
}

Queue::~Queue(){
	delete front;
	
}

void Queue::enqueue(int data){
	node *temp = new node();
	temp->Value = data;
	temp->next = NULL;
	if (front == NULL) {
		front = temp;
	}
	else {
		rear->next = temp;
	}
	rear = temp;
	
}

string Queue::dequeue(){
	node *temp = new node();
	string data;
	if (front == NULL) {
		cout << "Empty" << endl;
	}
	else {
		temp = front;
		data = temp->Value;
		front = front->next;
		delete temp;
	}
	return data;


}

node *Queue::getHead(){
	node *temp = new node();
	if (front == NULL) {
		cout << "empty";
	}
	else {
		temp = front;
	}

	return temp;
	
}